import React, { Component } from 'react'
import { Swiper } from 'react-vant';
import { items } from './demo/items';
import './demo/base.less'
import axios from "axios"
console.log(444)
export class homeage extends Component {
  constructor(props) {
    super(props)
  
    this.state = {
       list:[]
    }
  }
  componentDidMount() { 
    axios.get("/list").then(res=>{
      this.setState({
        list:res.data
      })
    })
   }
  render() {
    const {list}=this.state
    return (
      <div>
        <ul>
           {
          list ? list.map((item,index)=>{
            return <li> <img src={item.img}/> {item.title}</li>
          }) :''
        }
        </ul>
       

      <div className="demo-swiper">
      <Swiper autoplay={5000}>{items}</Swiper>
     </div>
      </div>
    )
  }
}

export default homeage